package com.ruoyi.warn.service.impl;

import java.util.List;
import java.util.UUID;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.warn.mapper.BusWaterWarnruleConditionsMapper;
import com.ruoyi.warn.domain.BusWaterWarnruleConditions;
import com.ruoyi.warn.service.IBusWaterWarnruleConditionsService;

/**
 * 预警规则条件Service业务层处理
 * 
 * @author maliang
 * @date 2025-09-10
 */
@Service
public class BusWaterWarnruleConditionsServiceImpl implements IBusWaterWarnruleConditionsService 
{
    @Autowired
    private BusWaterWarnruleConditionsMapper busWaterWarnruleConditionsMapper;

    /**
     * 查询预警规则条件
     * 
     * @param id 预警规则条件主键
     * @return 预警规则条件
     */
    @Override
    public BusWaterWarnruleConditions selectBusWaterWarnruleConditionsById(String id)
    {
        return busWaterWarnruleConditionsMapper.selectBusWaterWarnruleConditionsById(id);
    }

    /**
     * 查询预警规则条件列表
     * 
     * @param busWaterWarnruleConditions 预警规则条件
     * @return 预警规则条件
     */
    @Override
    public List<BusWaterWarnruleConditions> selectBusWaterWarnruleConditionsList(BusWaterWarnruleConditions busWaterWarnruleConditions)
    {
        return busWaterWarnruleConditionsMapper.selectBusWaterWarnruleConditionsList(busWaterWarnruleConditions);
    }

    /**
     * 新增预警规则条件
     * 
     * @param busWaterWarnruleConditions 预警规则条件
     * @return 结果
     */
    @Override
    public int insertBusWaterWarnruleConditions(BusWaterWarnruleConditions busWaterWarnruleConditions)
    {
        busWaterWarnruleConditions.setId(UUID.randomUUID().toString());
        busWaterWarnruleConditions.setUserid(SecurityUtils.getUserId());
        busWaterWarnruleConditions.setCreatetime(DateUtils.getNowDate());
        return busWaterWarnruleConditionsMapper.insertBusWaterWarnruleConditions(busWaterWarnruleConditions);
    }

    /**
     * 修改预警规则条件
     * 
     * @param busWaterWarnruleConditions 预警规则条件
     * @return 结果
     */
    @Override
    public int updateBusWaterWarnruleConditions(BusWaterWarnruleConditions busWaterWarnruleConditions)
    {
        busWaterWarnruleConditions.setUpdatetime(DateUtils.getNowDate());
        return busWaterWarnruleConditionsMapper.updateBusWaterWarnruleConditions(busWaterWarnruleConditions);
    }

    /**
     * 批量删除预警规则条件
     * 
     * @param ids 需要删除的预警规则条件主键
     * @return 结果
     */
    @Override
    public int deleteBusWaterWarnruleConditionsByIds(String[] ids)
    {
        return busWaterWarnruleConditionsMapper.deleteBusWaterWarnruleConditionsByIds(ids);
    }

    /**
     * 删除预警规则条件信息
     * 
     * @param id 预警规则条件主键
     * @return 结果
     */
    @Override
    public int deleteBusWaterWarnruleConditionsById(String id)
    {
        return busWaterWarnruleConditionsMapper.deleteBusWaterWarnruleConditionsById(id);
    }
}
